package com.hbt.word_consumer.service;

import com.hbt.api.entity.CommonResult;
import com.hbt.api.entity.StaticBean;
import com.hbt.api.entity.Word;
import com.hbt.api.entity.WordsCondition;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("word-provider")
public interface WordConsumerFeign {
    String pre = "word_provider/";

    @PostMapping(pre+"del_word")
    public CommonResult<String> delWord(@RequestParam("wordid") int wordid);

    @PostMapping(pre+"get_progress")
    public CommonResult<StaticBean> getProgress(@RequestParam("userid") int userid);

    @PostMapping(pre+"fanyi")
    public CommonResult fanyi(@RequestParam("src") String src);

    @PostMapping(pre+"add_word")
    public CommonResult<String> addWord(Word word);

    @PostMapping(pre+"get_word_by_condition")
    public List<Word> getWordByCondition(WordsCondition wordsCondition);

    @PostMapping(pre+"get_word_by_wordid")
    public Word getWordByWordID(@RequestParam("wordid") int wordid);

    @PostMapping(pre+"update_word")
    public CommonResult updateWord(Word word);

    @PostMapping(pre+"find_similar")
    public CommonResult<List<Word>> findSimilar(@RequestParam("src") String src, @RequestParam("rate") int rate, @RequestBody List<Word> words);
}
